//
//  LBViewController.m
//  LBDownLoadManager
//
//  Created by liubo on 12/18/2021.
//  Copyright (c) 2021 liubo. All rights reserved.
//

#import "LBViewController.h"
#import <LBDownLoadManager/LBDownLoadManager.h>

#define CachePath [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"cache"]

#define kTmpPath NSTemporaryDirectory()

@interface LBViewController ()

@end

@implementation LBViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self downLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)downLoad
{
    NSString *downloadUrl = @"https://file-test.thepaper.cn/clt/pkg/skin/appskin_solarTerm_Xiaoshu.zip";
    
    LBDownLoadManager *manger = [[LBDownLoadManager alloc]init];
    manger.fileName = @"夏至.zip";
    [manger downLoader:[NSURL URLWithString:downloadUrl] downloadPath:CachePath tempPath:kTmpPath downLoadInfo:^(long long totalSize) {
        NSLog(@"下载信息:%lld",totalSize);
    } progress:^(float progress) {
        NSLog(@"下载进度:%f",progress);
    } success:^(NSString *cachePath) {
        NSLog(@"下载成功路径:%@",cachePath);
    } failed:^{
        NSLog(@"下载失败");

    }];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
